package com.springboot.erp.service.impl;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.erp.entity.ProductInfo;
import com.springboot.erp.mapper.ProductInfoMapper;
import com.springboot.erp.service.ProductInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class ProductInfoImpl implements ProductInfoService {

    @Resource
    private ProductInfoMapper productInfoMapper;
    @Override
    public Page<ProductInfo > getProductInfo(Long materialId,Long depotId,int current, int size,
                                      String orderBy, boolean asc) {
        Page<ProductInfo> page = new Page<>(current, size);
        page.addOrder(new OrderItem().setColumn(orderBy).setAsc(asc));
        page = productInfoMapper.selectProductBaseInfo(materialId,depotId,page);
        return page;
    }


}
